package com.rk;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@SpringBootApplication
@RestController
@Slf4j
public class Application {

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}

	@GetMapping("/users")
	public List<User> getUsers(){
		return createUserList();
	}

	public List<User> createUserList(){
		log.info("create user list");
		return Arrays.asList(
				new User("xiao0",23),
				new User("xiao1",12),
				new User("xiao2",18)
		);
	}
}
